package com.example.travel_front.Fragment;

import android.content.Intent;
import android.os.Bundle;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;

import com.example.travel_front.Activity.SettingActivity;
import com.example.travel_front.Activity.UserDetailActivity;
import com.example.travel_front.R;

public class UserFragment extends Fragment {

    public UserFragment() {
        // Required empty public constructor
    }

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {
        // Inflate the layout for this fragment
        return inflater.inflate(R.layout.fragment_user, container, false);

    }
    @Override
    public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
        super.onViewCreated(view, savedInstanceState);

        // Initialize the ImageView and set an OnClickListener
        ImageView arrowIcon = view.findViewById(R.id.icon_arrow);
        arrowIcon.setOnClickListener(v -> {
            // Create an Intent to start the new activity
            Intent intent = new Intent(getActivity(), UserDetailActivity.class);
            startActivity(intent);

            // Optionally, if you wish to finish the current activity
            // getActivity().finish();
        });
        ImageView settingsImageView = view.findViewById(R.id.icon_setting);
        settingsImageView.setOnClickListener(v -> {
            // Create an Intent to start the new activity
            Intent intent = new Intent(getActivity(), SettingActivity.class);
            startActivity(intent);

            // Optionally, if you wish to finish the current activity
            // getActivity().finish();
        });
    }
}
